﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace iLangl.BusinessModel.DAL.XMLStorage
{
	internal class UserDAL : BaseStorageDAL, IUserDAL
	{
		#region IUserDAL Members

		public User GetUser(string companyId)
		{
			foreach (dtoXmlStorage.UserAccountsRow uar in Storage.UserAccounts)
			{
				dtoXmlStorage.ContactRow cr = Storage.Contact.FindById(uar.ContactId);

				if (cr.CompanyId == companyId)
				{
					User user = new User();
					user.Id = uar.Id;
					user.UserName = uar.UserName;
					user.Password = uar.Password;
					return user;
				}
			}

			return null;
		}

		#endregion
	}
}
